using System;
using System.Collections.Generic;
using System.Text;

namespace Mud.EmlenMudMain
{

    public enum DataStorageFormatTypes
    {
        CompressedSerialization = 0,
        OldTextFileFormat = 1,
        SQLDatabase = 2,
        MySqlDatabase = 3
    }

    public static class MiscConstants
    {
        public static DataStorageFormatTypes DataStorageFormat = DataStorageFormatTypes.OldTextFileFormat;

        public static string DataFileDirectory = "datafiles";
        public static string PLAYER_DIR = "plr";
        public static string AREA_DIR = "areas";
        public static string AREA_LIST = "playarea.lst";
        public static string NOTE_FILE = "plnotes.txt";

        public static int LEVEL_MAXIMUM = 110;				// The maximum level
        public static int LEVEL_PLAYER_BUILDER = 103;		// Builder level
        public static int LEVEL_PLAYER_IMMORTAL = 101;	// Minimum immortal level
        public static int MAX_PLAYER_ALIASES = 35;			// Maximum player defined aliases a person can set up

        // ----------------------------------------------------------------------- */
        // For portals.  value 4 to retain compatibility with mortal conquest code */
        // ----------------------------------------------------------------------- */
        public static int FURN_EXIT = 4;
        public static int MAX_TRADE = 5;	///* Don//t change this. */
        public static int STOREDIV = 14;	///*item cost is divided by this to determine the cost it will be to store the item */

    }

    public static class ColorConstants
    {
        /// <summary>
        /// The color for items laying on the ground.
        /// </summary>
        public static string ITEMCOLOR = "\x1b[036m";

        // ----------------------------------- */
        // Color defines and other ANSI codes. */
        // ----------------------------------- */
        public static string BLACK = "\x1b[30m";
        public static string RED = "\x1b[31m";
        public static string GREEN = "\x1b[32m";
        public static string YELLOW = "\x1b[33m";
        public static string BLUE = "\x1b[34m";
        public static string PURPLE = "\x1b[35m";
        public static string CYAN = "\x1b[36m";
        public static string GREY = "\x1b[37m";

        public static string B_BLACK = "\x1b[40m";
        public static string B_RED = "\x1b[41m";
        public static string B_GREEN = "\x1b[42m";
        public static string B_YELLOW = "\x1b[43m";
        public static string B_BLUE = "\x1b[44m";
        public static string B_PURPLE = "\x1b[45m";
        public static string B_CYAN = "\x1b[46m";
        public static string B_GREY = "\x1b[47m";

        public static string CLRSCR = "\x1b[2J";
        public static string CLREOL = "\x1b[K";

        public static string DOWNARROW = "\x1b[B";
        public static string RIGHTARROW = "\x1b[C";
        public static string UPARROW = "\x1b[A";
        public static string LEFTARROW = "\x1b[D";
        public static string HOMEPOS = "\x1b[H";

        public static string BOLD = "\x1b[1m";
        public static string FLASH = "\x1b[5m";
        public static string INVERSE = "\x1b[7m";
        public static string NTEXT = "\x1b[0m";
        public static string TAB = "\x9";
    }

    public static class Telnet
    {
        //
        //Definitions for the TELNET protocol.
        //
        public enum TelnetCommands
        {
            BINARY = 0,
            ECHO = 1,
            RCP = 2,
            SGA = 3,
            NAMS = 4,
            STATUS = 5,
            TM = 6,
            RCTE = 7,
            NAOL = 8,
            NAOP = 9,
            NAOCRD = 10,
            NAOHTS = 11,
            NAOHTD = 12,
            NAOFFD = 13,
            NAOVTS = 14,
            NAOVTD = 15,
            NAOLFD = 16,
            XASCII = 17,
            LOGOUT = 18,
            BM = 19,
            DET = 20,
            SUPDUP = 21,
            SUPDUPOUTPUT = 22,
            SNDLOC = 23,
            TTYPE = 24,
            xxEOR = 25,
            TUID = 26,
            xxOUTMRK = 27,
            TTYLOC = 28,
            REGIME3270 = 29,
            X3PAD = 30,
            NAWS = 31,
            TSPEED = 32,
            LFLOW = 33,
            LINEMODE = 34,
            XDISPLOC = 35,
            OLD_ENVIRON = 36,
            AUTHENTICATION = 37,
            ENCRYPT = 38,
            NEW_ENVIRON = 39,
            IAC = 255,
            DONT = 254,
            YESDO = 253,
            WONT = 252,
            WILL = 251,
            SB = 250,
            GA = 249,
            EL = 248,
            EC = 247,
            AYT = 246,
            AO = 245,
            IP = 244,
            BREAK = 243,
            DM = 242,
            NOP = 241,
            SE = 240,
            EOR = 239,
            ABORT = 238,
            SUSP = 237,
            xxEOF = 236,
            SYNCH = 242
        }

        public static int TELOPT_BINARY = 0;	// =8-bit data path */
        public static int TELOPT_ECHO = 1; // echo */
        public static int TELOPT_RCP = 2;	// prepare to reconnect */
        public static int TELOPT_SGA = 3;	// suppress go ahead */
        public static int TELOPT_NAMS = 4; // approximate message size */
        public static int TELOPT_STATUS = 5;	// give status */
        public static int TELOPT_TM = 6; // timing mark */
        public static int TELOPT_RCTE = 7; // remote controlled transmission and echo */
        public static int TELOPT_NAOL = 8; // negotiate about output line width */
        public static int TELOPT_NAOP = 9; // negotiate about output page size */
        public static int TELOPT_NAOCRD = 10; // negotiate about CR disposition */
        public static int TELOPT_NAOHTS = 11; // negotiate about horizontal tabstops */
        public static int TELOPT_NAOHTD = 12; // negotiate about horizontal tab disposition */
        public static int TELOPT_NAOFFD = 13; // negotiate about formfeed disposition */
        public static int TELOPT_NAOVTS = 14; // negotiate about vertical tab stops */
        public static int TELOPT_NAOVTD = 15; // negotiate about vertical tab disposition */
        public static int TELOPT_NAOLFD = 16; // negotiate about output LF disposition */
        public static int TELOPT_XASCII = 17; // extended ascic character set */
        public static int TELOPT_LOGOUT = 18; // force logout */
        public static int TELOPT_BM = 19;	// byte macro */
        public static int TELOPT_DET = 20; // data entry terminal */
        public static int TELOPT_SUPDUP = 21; // supdup protocol */
        public static int TELOPT_SUPDUPOUTPUT = 22; // supdup output */
        public static int TELOPT_SNDLOC = 23; // send location */
        public static int TELOPT_TTYPE = 24;	// terminal type */
        public static int TELOPT_EOR = 25; // end or record */
        public static int TELOPT_TUID = 26; // TACACS user identification */
        public static int TELOPT_OUTMRK = 27; // output marking */
        public static int TELOPT_TTYLOC = 28; // terminal location number */
        public static int TELOPT_3270REGIME = 29; // =3270 regime */
        public static int TELOPT_X3PAD = 30;	// X.=3 PAD */
        public static int TELOPT_NAWS = 31; // window size */
        public static int TELOPT_TSPEED = 32; // terminal speed */
        public static int TELOPT_LFLOW = 33;// remote flow control */
        public static int TELOPT_LINEMODE = 34;	// Linemode option */
        public static int TELOPT_XDISPLOC = 35;	// X Display ApplyEffectLocation */
        public static int TELOPT_OLD_ENVIRON = 36;	// Old - Environment variables */
        public static int TELOPT_AUTHENTICATION = 37;	// Authenticate */
        public static int TELOPT_ENCRYPT = 38; // Encryption option */
        public static int TELOPT_NEW_ENVIRON = 39;	// New - Environment variables */
        public static int TELOPT_EXOPL = 255; // extended-options-list */

        // sub-option qualifiers */
        public static int TELQUAL_IS = 0;	// option is... */
        public static int TELQUAL_SEND = 1; // send option */
        public static int TELQUAL_INFO = 2; // ENVIRON: informational version of IS */
        public static int TELQUAL_REPLY = 2;	// AUTHENTICATION: client version of IS */
        public static int TELQUAL_NAME = 3; // AUTHENTICATION: client version of IS */

        public static int LFLOW_OFF = 0; // Disable remote flow control */
        public static int LFLOW_ON = 1; // Enable remote flow control */
        public static int LFLOW_RESTART_ANY = 2; // Restart output on any char */
        public static int LFLOW_RESTART_XON = 3; // Restart output only on XON */
        public static int LM_MODE = 1;
        public static int LM_FORWARDMASK = 2;
        public static int LM_SLC = 3;
        public static byte MODE_EDIT = 0x1;
        public static byte MODE_TRAPSIG = 0x2;
        public static byte MODE_ACK = 0x4;
        public static byte MODE_SOFT_TAB = 0x8;
        public static byte MODE_LIT_ECHO = 0x10;
        public static byte MODE_MASK = 0x1F;

        // Not part of protocol, but needed to simplify things... */
        public static int MODE_FLOW = 0x100;
        public static int MODE_ECHO = 0x200;
        public static int MODE_INBIN = 0x400;
        public static int MODE_OUTBIN = 0x800;
        public static int MODE_FORCE = 0x1000;

        public static int SLC_SYNCH = 1;
        public static int SLC_BRK = 2;
        public static int SLC_IP = 3;
        public static int SLC_AO = 4;
        public static int SLC_AYT = 5;
        public static int SLC_EOR = 6;
        public static int SLC_ABORT = 7;
        public static int SLC_EOF = 8;
        public static int SLC_SUSP = 9;
        public static int SLC_EC = 10;
        public static int SLC_EL = 11;
        public static int SLC_EW = 12;
        public static int SLC_RP = 13;
        public static int SLC_LNEXT = 14;
        public static int SLC_XON = 15;
        public static int SLC_XOFF = 16;
        public static int SLC_FORW1 = 17;
        public static int SLC_FORW2 = 18;

        public static int NSLC = 18;

        public static int SLC_NOSUPPORT = 0;
        public static int SLC_CANTCHANGE = 1;
        public static int SLC_VARIABLE = 2;
        public static int SLC_DEFAULT = 3;

        public static int SLC_FUNC = 0;
        public static int SLC_FLAGS = 1;
        public static int SLC_VALUE = 2;
        public static int SLC_LEVELBITS = 0x3;
        public static int SLC_ACK = 0x80;
        public static int SLC_FLUSHIN = 0x40;
        public static int SLC_FLUSHOUT = 0x20;

        public static int OLD_ENV_VAR = 1;
        public static int OLD_ENV_VALUE = 0;
        public static int NEW_ENV_VAR = 0;
        public static int NEW_ENV_VALUE = 1;
        public static int ENV_ESC = 2;
        public static int ENV_USERVAR = 3;

        public static int AUTH_WHO_CLIENT = 0; // Client authenticating server */
        public static int AUTH_WHO_SERVER = 1; // Server authenticating client */
        public static int AUTH_WHO_MASK = 1;

        //
        // amount of authentication done
        ///
        public static int AUTH_HOW_ONE_WAY = 0;
        public static int AUTH_HOW_MUTUAL = 2;
        public static int AUTH_HOW_MASK = 2;

        public static int AUTHTYPE_NULL = 0;
        public static int AUTHTYPE_KERBEROS_V4 = 1;
        public static int AUTHTYPE_KERBEROS_V5 = 2;
        public static int AUTHTYPE_SPX = 3;
        public static int AUTHTYPE_MINK = 4;
        public static int AUTHTYPE_CNT = 5;

        public static int AUTHTYPE_TEST = 99;
        //
        // ENCRYPTion suboptions
        ///
        public static int ENCRYPT_IS = 0;	// I pick encryption type ... */
        public static int ENCRYPT_SUPPORT = 1; // I support encryption types ... */
        public static int ENCRYPT_REPLY = 2;	// Initial setup response */
        public static int ENCRYPT_START = 3;	// Am starting to send encrypted */
        public static int ENCRYPT_END = 4; // Am ending encrypted */
        public static int ENCRYPT_REQSTART = 5;	// Request you start encrypting */
        public static int ENCRYPT_REQEND = 6; // Request you send encrypting */
        public static int ENCRYPT_ENC_KEYID = 7;
        public static int ENCRYPT_DEC_KEYID = 8;
        public static int ENCRYPT_CNT = 9;

        public static int ENCTYPE_ANY = 0;
        public static int ENCTYPE_DES_CFB64 = 1;
        public static int ENCTYPE_DES_OFB64 = 2;
        public static int ENCTYPE_CNT = 3;

        //
        //* Definitions for the TELNET protocol.
        //*/
        public static int IAC = 255; // interpret as command: */
        public static int DONT = 254; // you are not to use option */
        public static int YESDO = 253; // please, you use option */
        public static int WONT = 252; // I won//t use option */
        public static int WILL = 251; // I will use option */
        public static int SB = 250; // interpret as subnegotiation */
        public static int GA = 249; // you may reverse the line */
        public static int EL = 248; // erase the current line */
        public static int EC = 247; // erase the current character */
        public static int AYT = 246;// are you there */
        public static int AO = 245;	// abort output--but let prog finish */
        public static int IP = 244;	// interrupt process--permanently */
        public static int BREAK = 243;		// break */
        public static int DM = 242;	// data mark--for connect. cleaning */
        public static int NOP = 241;	// nop */
        public static int SE = 240;	// end sub negotiation */
        public static int EOR = 239; // end of record (transparent mode) */
        public static int ABORT = 238;		// Abort process */
        public static int SUSP = 237;		// Suspend process */
        public static int xEOF = 236;		// End of file: EOF is already used... */
        public static int SYNCH = 242; // for telfunc calls */
    }
    public class Constants
    {
        public Constants()
        {
            spc[0] = ' ';
            tilde[0] = '~';

            dont_echo[0] = ((byte)Telnet.TelnetCommands.IAC);
            dont_echo[1] = ((byte)Telnet.TelnetCommands.DONT);
            dont_echo[2] = ((byte)Telnet.TelnetCommands.ECHO);

            wont_echo[0] = ((byte)Telnet.TelnetCommands.IAC);
            wont_echo[1] = ((byte)Telnet.TelnetCommands.WONT);
            wont_echo[2] = ((byte)Telnet.TelnetCommands.ECHO);

            will_echo[0] = ((byte)Telnet.TelnetCommands.IAC);
            will_echo[1] = ((byte)Telnet.TelnetCommands.WILL);
            will_echo[2] = ((byte)Telnet.TelnetCommands.ECHO);

            wont_supress_ga[0] = ((byte)Telnet.TelnetCommands.IAC);
            wont_supress_ga[1] = ((byte)Telnet.TelnetCommands.WONT);
            wont_supress_ga[2] = ((byte)Telnet.TelnetCommands.SGA);

            will_supress_ga[0] = ((byte)Telnet.TelnetCommands.IAC);
            will_supress_ga[1] = ((byte)Telnet.TelnetCommands.WILL);
            will_supress_ga[2] = ((byte)Telnet.TelnetCommands.SGA);

            do_echo[0] = ((byte)Telnet.TelnetCommands.IAC);
            do_echo[1] = ((byte)Telnet.TelnetCommands.YESDO);
            do_echo[2] = ((byte)Telnet.TelnetCommands.ECHO);

            echo_off_str[0] = ((byte)Telnet.TelnetCommands.IAC);
            echo_off_str[1] = ((byte)Telnet.TelnetCommands.WILL);
            echo_off_str[2] = ((byte)Telnet.TelnetCommands.ECHO);

            echo_on_str[0] = ((byte)Telnet.TelnetCommands.IAC);
            echo_on_str[1] = ((byte)Telnet.TelnetCommands.WONT);
            echo_on_str[2] = ((byte)Telnet.TelnetCommands.ECHO);

            go_ahead[0] = ((byte)Telnet.TelnetCommands.IAC);
            go_ahead[1] = ((byte)Telnet.TelnetCommands.GA);

            linemode_off[0] = ((byte)Telnet.TelnetCommands.IAC);
            linemode_off[1] = ((byte)Telnet.TelnetCommands.WILL);
            linemode_off[2] = ((byte)Telnet.TelnetCommands.SGA);

            linemode_on[0] = ((byte)Telnet.TelnetCommands.IAC);
            linemode_on[1] = ((byte)Telnet.TelnetCommands.WONT);
            linemode_on[2] = ((byte)Telnet.TelnetCommands.SGA);
        }
        private char[] spc = new char[1];

        public char[] Spc
        {
            get { return spc; }
            set { spc = value; }
        }
        private char[] tilde = new char[1];

        public char[] Tilde
        {
            get { return tilde; }
            set { tilde = value; }
        }
        private byte[] wont_echo = new byte[3];

        public byte[] Wont_echo
        {
            get { return wont_echo; }
            set { wont_echo = value; }
        }
        private byte[] will_echo = new byte[3];

        public byte[] Will_echo
        {
            get { return will_echo; }
            set { will_echo = value; }
        }
        private byte[] wont_supress_ga = new byte[3];

        public byte[] Wont_supress_ga
        {
            get { return wont_supress_ga; }
            set { wont_supress_ga = value; }
        }
        private byte[] will_supress_ga = new byte[3];

        public byte[] Will_supress_ga
        {
            get { return will_supress_ga; }
            set { will_supress_ga = value; }
        }
        private byte[] dont_echo = new byte[3];

        public byte[] Dont_echo
        {
            get { return dont_echo; }
            set { dont_echo = value; }
        }
        private byte[] do_echo = new byte[3];

        public byte[] Do_echo
        {
            get { return do_echo; }
            set { do_echo = value; }
        }
        private byte[] echo_off_str = new byte[3];

        public byte[] Echo_off_str
        {
            get { return echo_off_str; }
            set { echo_off_str = value; }
        }
        private byte[] echo_on_str = new byte[3];

        public byte[] Echo_on_str
        {
            get { return echo_on_str; }
            set { echo_on_str = value; }
        }
        private byte[] go_ahead = new byte[2];

        public byte[] Go_ahead
        {
            get { return go_ahead; }
            set { go_ahead = value; }
        }
        private byte[] linemode_off = new byte[3];

        public byte[] Linemode_off
        {
            get { return linemode_off; }
            set { linemode_off = value; }
        }
        private byte[] linemode_on = new byte[3];

        public byte[] Linemode_on
        {
            get { return linemode_on; }
            set { linemode_on = value; }
        }


    }
}
